﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Criterion;
using SuperMarketManagement.Entity;

namespace SuperMarketManagement.DAO.NHibernate
{
    public class InvoiceDAO : GenericDAO<Invoice, long>
    {
        public InvoiceDAO(ISession session)
            : base(session)
        {
        }

        public IList<Invoice> GetByCustomer(Customer customer)
        {
            return Session
                .CreateCriteria(typeof (Invoice))
                .Add(Expression.Eq("Customer.AutoId", customer.AutoId))
                .List<Invoice>();
        }
    }
}
